using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ProductionPSMap : EntityTypeConfiguration<so_ProductionPS>
    {
        public so_ProductionPSMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Sale_Order, t.Order_Date, t.Currency, t.Work_Order });

            // Properties
            this.Property(t => t.Sale_Order)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Customer)
                .HasMaxLength(110);

            this.Property(t => t.Currency)
                .IsRequired()
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("so_ProductionPS");
            this.Property(t => t.Sale_Order).HasColumnName("Sale_Order");
            this.Property(t => t.Order_Date).HasColumnName("Order_Date");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.Closed).HasColumnName("Closed");
            this.Property(t => t.Amount).HasColumnName("Amount");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.Delivery_Date).HasColumnName("Delivery_Date");
            this.Property(t => t.COST).HasColumnName("COST");
            this.Property(t => t.Work_Order).HasColumnName("Work_Order");
        }
    }
}
